<?php
/**
 * 所有需要用户登录身份验证的验证控制器
 * 必传参数：token   用户登录token
 */
namespace App\Http\Controllers;
use DB;

class TokenController extends BaseController
{
    public function __construct()
    {
        // 载入父级
        parent::__construct();
        if(empty($_REQUEST['token'])){
            exit(json_encode(['code'=>-9003,'msg'=>'token缺失']));
        }
        $token = $_REQUEST['token'];

        $isValidToken = $this->checkToken($token);
        if($isValidToken=='-9001'){
            exit(json_encode(['code'=>-9001,'msg'=>'token过期']));
        }elseif ($isValidToken=='-9002'){

            exit(json_encode(['code'=>-9002,'msg'=>'token无效']));
        }else{
            $this->loginUserInfo = $isValidToken;
        }
    }

}